home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / Term::Cap.Z / Term::Cap
Encoding:
Text File  |  1998-10-28  |  5.0 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      TTTTeeeerrrrmmmm::::::::CCCCaaaapppp((((3333))))    22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))      TTTTeeeerrrrmmmm::::::::CCCCaaaapppp((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       Term::Cap - Perl termcap interface
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           require Term::Cap;
  13.           $terminal    = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };
  14.           $terminal->Trequire(qw/ce    ku kd/);
  15.           $terminal->Tgoto('cm', $col, $row, $FH);
  16.           $terminal->Tputs('dl', $count, $FH);
  17.           $terminal->Tpad($string, $count, $FH);
  18.  
  19.  
  20.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  21.       These    are low-level functions    to extract and use
  22.       capabilities from a terminal capability (termcap) database.
  23.  
  24.       The TTTTggggeeeetttteeeennnntttt function extracts    the entry of the specified
  25.       terminal type    _T_E_R_M (defaults to the environment variable
  26.       _T_E_R_M)    from the database.
  27.  
  28.       It will look in the environment for a    _T_E_R_M_C_A_P    variable.  If
  29.       found, and the value does not    begin with a slash, and    the
  30.       terminal type    name is    the same as the    environment string
  31.       _T_E_R_M,    the _T_E_R_M_C_A_P string is used instead of reading a
  32.       termcap file.     If it does begin with a slash,    the string is
  33.       used as a path name of the termcap file to search.  If
  34.       _T_E_R_M_C_A_P does not begin with a    slash and name is different
  35.       from _T_E_R_M, TTTTggggeeeetttteeeennnntttt searches the files    $_H_O_M_E/._t_e_r_m_c_a_p,
  36.       /_e_t_c/_t_e_r_m_c_a_p,    and /_u_s_r/_s_h_a_r_e/_m_i_s_c/_t_e_r_m_c_a_p, in    that order,
  37.       unless the environment variable _T_E_R_M_P_A_T_H exists, in which
  38.       case it specifies a list of file pathnames (separated    by
  39.       spaces or colons) to be searched iiiinnnnsssstttteeeeaaaadddd.  Whenever multiple
  40.       files    are searched and a tc field occurs in the requested
  41.       entry, the entry it names must be found in the same file or
  42.       one of the succeeding    files.    If there is a :tc=...: in the
  43.       _T_E_R_M_C_A_P environment variable string it will continue the
  44.       search in the    files as above.
  45.  
  46.       _O_S_P_E_E_D is the    terminal output    bit rate (often    mistakenly
  47.       called the baud rate).  _O_S_P_E_E_D can be    specified as either a
  48.       POSIX    termios/SYSV termio speeds (where 9600 equals 9600) or
  49.       an old BSD-style speeds (where 13 equals 9600).
  50.  
  51.       TTTTggggeeeetttteeeennnntttt returns a blessed object reference which the user
  52.       can then use to send the control strings to the terminal
  53.       using    TTTTppppuuuuttttssss and TTTTggggoooottttoooo.  It calls croak on failure.
  54.  
  55.       TTTTggggoooottttoooo    decodes    a cursor addressing string with    the given
  56.       parameters.
  57.  
  58.       The output strings for TTTTppppuuuuttttssss are cached for counts of    1 for
  59.       performance.    TTTTggggoooottttoooo and TTTTppppaaaadddd do not cache.  $self->{_xx} is
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTeeeerrrrmmmm::::::::CCCCaaaapppp((((3333))))    22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))      TTTTeeeerrrrmmmm::::::::CCCCaaaapppp((((3333))))
  71.  
  72.  
  73.  
  74.       the raw termcap data and $self->{xx} is the cached version.
  75.  
  76.           print $terminal->Tpad($self->{_xx}, 1);
  77.  
  78.       TTTTggggoooottttoooo, TTTTppppuuuuttttssss,    and TTTTppppaaaadddd return    the string and will also
  79.       output the string to $FH if specified.
  80.  
  81.       The extracted    termcap    entry is available in the object as
  82.       $self->{TERMCAP}.
  83.  
  84.      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  85.           #    Get terminal output speed
  86.           require POSIX;
  87.           my $termios = new    POSIX::Termios;
  88.           $termios->getattr;
  89.           my $ospeed = $termios->getospeed;
  90.  
  91.           #    Old-style ioctl    code to    get ospeed:
  92.           #        require 'ioctl.pl';
  93.           #        ioctl(TTY,$TIOCGETP,$sgtty);
  94.           #        ($ispeed,$ospeed) =    unpack('cc',$sgtty);
  95.  
  96.           #    allocate and initialize    a terminal structure
  97.           $terminal    = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };
  98.  
  99.           #    require    certain    capabilities to    be available
  100.           $terminal->Trequire(qw/ce    ku kd/);
  101.  
  102.           #    Output Routines, if $FH    is undefined these just    return the string
  103.  
  104.           #    Tgoto does the % expansion stuff with the given    args
  105.           $terminal->Tgoto('cm', $col, $row, $FH);
  106.  
  107.           #    Tputs doesn't do any % expansion.
  108.           $terminal->Tputs('dl', $count = 1, $FH);
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.